package org.thingsboard.server.common.data.id.custom;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.thingsboard.server.common.data.EntityType;
import org.thingsboard.server.common.data.id.EntityId;
import org.thingsboard.server.common.data.id.UUIDBased;

import java.util.UUID;

@ApiModel
public class DeviceGroupId extends UUIDBased implements EntityId {

    private static final long serialVersionUID = 1L;

    @JsonCreator
    public DeviceGroupId(@JsonProperty("id") UUID id) {
        super(id);
    }

    @ApiModelProperty(position = 2, required = true, value = "string", example = "GROUP", allowableValues = "GROUP")
    @Override
    public EntityType getEntityType() {
        return EntityType.DEVICE_GROUP;
    }

    public static DeviceGroupId fromString(String groupId) {
        return new DeviceGroupId(UUID.fromString(groupId));
    }
}
